<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<TITLE> jTmpl test</TITLE>
<script type="text/javascript" src="../jtmpl.js"></script>
</HEAD>
<BODY>
<table width="100%">
<tr>
	<td width="50%">
		<!-- ########### Template - Start ########### -->
		Template:<br />
		<textarea rows="10"  id="tmpl_in" style="width: 100%">
<table>	<% FOR item IN rows2 %>
	<tr>
	<% SET yy = loop %>
	<td><% yy %></td>
	<% FOR item in item %>
	<% IF loop.index == 3 %><% LAST %><% END %><td><%loop.index%></td>
	<% END %>
	</tr>
	<% END %>
</table>
</textarea>
		<!-- ########### Template - End ########### -->
	</td>
	<td>
	Data in:
	<textarea rows="10" style="width: 100%" id="json_in">
{
	rows2: [
		[ 1, 2, 3, 4, 5, 6],
		[ 2, 3, 4, 5, 6, 7],
		[ 2, 3, 4, 5, 6, 8],
		[ 3, 4, 5, 6, 7, 8],
		[ 4, 5, 6, 7, 8, 9],
		[ 5, 6, 7, 8, 9, 10]
	]
}
</textarea></td>
</tr>
</table>
<hr>
<label for="ch1">Debug::</label>&nbsp;<input id="ch1" type="checkbox" onChange="set_debug(this.checked)">&nbsp;|&nbsp;<input type="button" id="" onClick="javascript: view();"; value="Run">
<div id="view" style="border:1px solid blue;"></div><hr><div id="w2"></div>

<script language="JavaScript">
<!--

function set_debug( ch ) {
	if (ch)	{
		jt.set_debug('w2');
		jt.set_debug_alert(true);
	} else {
		jt.set_debug_alert(false);
		document.getElementById( 'w2' ).innerHTML = '';
	}

}


var jt = new jtmpl();
function view() {
	jt.reload();
	jt.compile_line( 'tmpl_in', document.getElementById( 'tmpl_in' ).value );
	var uu = ' uu = ' + document.getElementById( 'json_in' ).value;
	try { 
		eval(uu); 
		document.getElementById( 'view' ).innerHTML = jt.print( 'tmpl_in', uu);
	}
	catch (e) { alert(e); return; }
}

//-->
</script>
</BODY>
</HTML>

